/**
 * 
 */
package com.zhongkai.service.book;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.zhongkai.dao.book.CommonBookDAO;
import com.zhongkai.model.book.TCsCclxdz;
import com.zhongkai.model.book.TCsCcsjs;
import com.zhongkai.model.book.TCsCcsjsndqj;
import com.zhongkai.model.book.TDjCcdjxx;
import com.zhongkai.service.BaseService;

/**
 * @packagename com.zhongkai.service.book
 * @filename CommonBookService.java
 * @作者 吴嘉俊，胡宇峰
 * @创建日期 Aug 4, 2011 2:34:20 PM
 *
 */

@Transactional
@Component
public class CommonBookService extends BaseService {
	private CommonBookDAO commonBookDAO;
	@Resource	
	public void setCommonBookDAO(CommonBookDAO commonBookDAO) {
		this.commonBookDAO = commonBookDAO;
	}




	/**
	 * 
	 * @author 吴嘉俊
	 * @param CarNo
	 * @param JjcclxDM
	 * @return
	 * @throws Exception
	 */
	public List FindCarNo(String CarNo,String JjcclxDM,String Ccdjh) throws Exception{
		List<TDjCcdjxx> list = commonBookDAO.findByHql("from TDjCcdjxx t where t.ccpzh=? and t.jjcclxDm=? and t.djztDm=? and ccdjh != ?",new Object[]{CarNo,JjcclxDM,"01",Integer.parseInt(Ccdjh)});
		return list;
	}
	
	/**
	 * 查找单位信息
	 * @param nsrbm 纳税人代码
	 * @return
	 * @throws Exception
	 */
	public List FindCarOwner(String nsrbm) throws Exception{
		List<TDjCcdjxx> list = commonBookDAO.findByHql("from TDjNsrxx p where p.nsrbm=?",new Object[]{nsrbm});
		return list;
	}
	
	/**
	 * 用于查找车船装备信息
	 * 这里是找出应税变更的时间年度
	 * @return
	 * @throws Exception
	 */
	public List FindTimePeriod() throws Exception{
		List<TCsCcsjsndqj> list = commonBookDAO.select("from TCsCcsjsndqj");
		return list;
	}
	
	/**
	 * 从交警车船代码转换为税务车船代码
	 * @param jjcclxDm 交警车船代码
	 * @return
	 * @throws Exception
	 */
	public List FindCwcclxDm(String jjcclxDm) throws Exception{
		List<TCsCclxdz> list = commonBookDAO.findByHql("from TCsCclxdz p where p.jjcclxDm=?",new Object[]{jjcclxDm});
		return list;
	}
	
	/**
	 * 能过时间区间，税务车船代码找出车船装备信息
	 * @param swdm
	 * @param period
	 * @return
	 * @throws Exception
	 */
	public List FindInfo(String swdm,String period) throws Exception{
		List<TCsCcsjs> list = commonBookDAO.findByHql("from TCsCcsjs p where p.swcclxDm=? and p.nsnd=?",new Object[]{swdm,period});
		return list;
	}
}
